﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Konstaller
{
    public class MainMenu
    {

        public struct menuitem
        {
            public int id;
            public string Name;
            public string Text;

        }

        int h, w;
        List<menuitem> MenuItem = new List<menuitem>();

        public void Initalize(int Width, int Height)
        {
            h = Height;
            w = Width;
        }


        public void AddMenu(menuitem Menuitem)
        {
           MenuItem.Add(Menuitem);  
        }

        const char topleft = '\u250C';
        const char top = '\u2500';
        const char topright = '\u2510';
        const char left = '\u2502';
        const char bleft = '\u2514';
        const char bright = '\u2518';
        
        public void DrawMenu()
        {
            Console.SetCursorPosition(0, 0);
            Console.BackgroundColor = ConsoleColor.DarkGray;
            Console.ForegroundColor = ConsoleColor.Gray;


            // Trance 1
            Console.Write(topleft);
            for (int i = 1; i < w-1; i++)
            {

                Console.SetCursorPosition(i, 0);
                Console.Write(top);

            }
            Console.SetCursorPosition(w - 1, 0);
            Console.Write(topright);

            //Trance 2

            Console.SetCursorPosition(0, 1);
            Console.Write(left);
            Console.SetCursorPosition(w - 1, 1);
            Console.Write(left);

            Console.SetCursorPosition(1, 1);

            int cx = 1;
            int cy = 1;

            for (int i = 0; i < w - 2; i++)
            {
                Console.Write(" ");
            }

            Console.SetCursorPosition(1, 1);

            for (int i = 0; i < MenuItem.Count; i++)
            {
                Console.Write(" " + MenuItem[i].Text);
            }

            // Trance 3

            Console.SetCursorPosition(0, 2);
            Console.Write(bleft);
            Console.SetCursorPosition(w - 1, 2);
            Console.Write(bright);
            Console.SetCursorPosition(1,2);

            for (int i = 1; i < w - 1; i++)
            {
                Console.SetCursorPosition(i, 2);
                Console.Write(top);
            }

        }
    }
}
